package com.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.pojo.User;
import com.utils.JsonUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author:周鹏
 * @date: 2020/11/23 16:17
 * @description:
 */
@RestController
public class UserController {
    @RequestMapping("/jason1")
    public String jason1() throws JsonProcessingException {
//        ObjectMapper mapper=new ObjectMapper();
//        User user=new User();
//        user.setUname("zzz");
//        user.setUpassword("1234");
//        String str=mapper.writeValueAsString(user);
//        return str;
//        Date date=new Date();
        //非静态
//        JsonUtils jsonUtils=new JsonUtils();
//        return jsonUtils.getJson(new Date());

        //静态方法工具类使用方式
            return JsonUtils.getJson(new Date());

    }
}
